﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Ria.Data;
using CARE.Web.Services;
using CARE.Views.Wizard.Setup;
namespace CARE
{
	public partial class SetupSimulation : UserControl
	{
        private GraphProvider gp;
        private SpreadVizualization spreadVizualization;
        private StateChangePlanWindow scpw;
        public SetupSimulation(SpreadVizualization sw)
		{
			// Required to initialize variables
			InitializeComponent();
            gp = new GraphProvider();
            spreadVizualization = sw;
            scpw = new StateChangePlanWindow();
            InvokeOperation<String[]> invokeOpGetAvaliableStateChangeMethods = gp.GetAvailableStateChangeStrategies();
            invokeOpGetAvaliableStateChangeMethods.Completed += new System.EventHandler(invokeOpGetAvaliableStateChangeMethods_Completed);
		}

		private void Steps_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
		{
            SimulationParameters sp = SimulationParameters.getInstance();
            sp.SimSteps = int.Parse(Steps.Text);
		}

		private void MinContacts_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
		{
            SimulationParameters sp = SimulationParameters.getInstance();
            sp.MinContacts = int.Parse(MinContacts.Text);
		}

		private void MaxContacts_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
		{
            SimulationParameters sp = SimulationParameters.getInstance();
            sp.MaxContacts = int.Parse(MaxContacts.Text);
		}

		private void vaccines_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
		{
			// TODO: Add event handler implementation here.
		}

		private void inculationChooser_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
		{
           // btnChangePlan.Visibility = Visibility.Visible;
            btnChangePlan.IsEnabled = true;
		}

		private void btnChangePlan_Click(object sender, System.Windows.RoutedEventArgs e)
		{
            scpw.Show();
		}

        void invokeOpGetAvaliableStateChangeMethods_Completed(object sender, System.EventArgs e)
        {
            InvokeOperation<String[]> invokeOpGetAvaliableStateChangeMethods = (InvokeOperation<String[]>)sender;
            inculationChooser.Items.Clear();
            foreach (var item in invokeOpGetAvaliableStateChangeMethods.Value )
                inculationChooser.Items.Add(item);
        }
	}
}